package com.example.springiocdemo2.controller;

import com.example.springiocdemo2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * @author Q
 * @create 2025-05-29-10:00
 */
@Controller
public class UserController {
    private UserService userService;
    public void setUserService() {
    }
    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    //构造方法注入
//    @Autowired
//    public UserController(UserService userService) {
//        this.userService = userService;
//    }

    //属性注入
//    @Autowired
//    private UserService userService;
    public void sayHai() {
        System.out.println("hi,userController!");
        userService.sayHai();
    }
}
